package model.bo;

import java.util.List;

import model.bean.Aluno;
import model.persistencia.dao.AlunoDAO;
import model.persistencia.dao.HibernateUtil;


public class AlunoBO {
	private AlunoDAO alunoDAO = new AlunoDAO(Aluno.class);
	
	public Aluno consultar(Aluno aluno){
		try {
			aluno = alunoDAO.load(new Long(1));
		} catch (Exception e) {
			HibernateUtil.getInstance().rollbackTransaction();
		}
		return aluno;
	}
	
	public List<Aluno> listar(Object aluno){
		
		List<Aluno> alunos = null;
		
		HibernateUtil.getInstance().startTransaction();
		try {
			alunos = alunoDAO.listar(aluno);
			HibernateUtil.getInstance().commitTransaction();
		} catch (Exception e) {
			e.printStackTrace();
			HibernateUtil.getInstance().rollbackTransaction();
		}
		
		return alunos;
		
	}
}

